home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Tools 5
/
Amiga Tools 5.iso
/
tools
/
developer-tools
/
andere sprachen
/
gamesmaster
/
demosrc
/
widescreen&sprite.s
< prev
next >
Wrap
Text File
|
1996-07-16
|
5KB
|
180 lines
;Horizontal Scroll 640
;---------------------
;This opens an extra wide screen of 256x640 pixels, and allows you to
;scroll left, right, up and down. This is *totally* inadequate for
;games such as platformers and shoot'em-ups etc because the picture size
;takes up huge amounts of memory. However for games like Skidmarks,
;Lemmings, Monkey Island, etc, such large screens can be a necessity.
opt o+
INCLUDE "exec/exec_lib.i"
INCLUDE "games/games_lib.i"
INCLUDE "games/games.i"
INCLUDE "games/gamesbase.i"
CALL MACRO
jsr _LVO\1(a6)
ENDM
LOCAL = 0
SECTION "ExtraLarge640",CODE
;===========================================================================;
; INITIALISE DEMO
;===========================================================================;
Start: MOVEM.L A0-A6/D1-D7,-(SP)
move.l ($4).w,a6
lea GMS_Name(pc),a1
moveq #$00,d0
CALL OpenLibrary
move.l d0,GMS_Base
beq Quit
move.l GMS_Base(pc),a6 ;Set task at the user-specified
CALL SetUserPri ;priority.
lea ScreenStruct(pc),a0
CALL Add_Screen
tst.l d0
bne Error
move.l SS_MemPtr1(a0),a1 ;Destination = SS_MemPtr1.
lea PackedPicFile(pc),a0 ;File Name.
CALL QuickLoad
tst.l d0
beq Error
lea ScreenStruct(pc),a0 ;Unpack the data on top of itself.
move.l SS_MemPtr1(a0),a1
move.l a1,a0
moveq #$00,d0
CALL SmartUnpack
lea ScreenStruct(pc),a0
lea SparkieStruct(pc),a1
CALL Init_Sprite
CALL Update_Sprite ;First get him onto the screen.
CALL Show_Screen
;===========================================================================;
; MAIN LOOP
;===========================================================================;
Loop: addq.w #1,d7 ;Animation/Frame delay, so that
btst #0,d7 ; our anim does not run too fast!
beq.s .mouse
cmp.w #5,SPR_Frame(a1) ;Do the animation for the sprite.
beq.s .reset ;(simply by increasing the frame
addq.w #1,SPR_Frame(a1) ; number).
bra.s .mouse
.reset clr.w SPR_Frame(a1)
.mouse moveq #JPORT1,d0 ;Read from port 1
CALL Read_Mouse ;Go get mouse position.
move.l d0,SPR_XPos(a1) ;Update the X/Y positions in one go.
tst.w Direction
beq.s .Right
.Left cmp.w #-16,SS_ScrollXCount(a0)
ble.s .Right
move.w #1,Direction
moveq #-1,d0
bra.s .scroll
.Right cmp.w #320-16,SS_ScrollXCount(a0)
bge.s .Left
clr.w Direction
moveq #1,d0
.scroll CALL HWScroll_Horizontal ;Reposition_Screen
CALL Wait_OSVBL
CALL Update_Sprite ;Put Sparkie on the screen.
btst #M_LMB,MouseButtons1+1(a6)
beq.s Loop
;===========================================================================;
; RETURN TO DOS
;===========================================================================;
CALL Delete_Screen ;Give back screen memory etc.
Error move.l GMS_Base(pc),a1
move.l ($4).w,a6
CALL CloseLibrary
Quit MOVEM.L (SP)+,A0-A6/D1-D7
moveq #$00,d0
rts
;===========================================================================;
; DATA
;===========================================================================;
Direction:
dc.w 0
GMS_Name:
dc.b "games.library",0
even
GMS_Base:
dc.l 0
AMT_PLANES = 4
SparkieStruct:
dc.w 0 ;Number 0.
dc.l Gfx_Sparkie ;Ptr to graphic.
dc.w 100,100 ;Beginning X/Y position
dc.w 0 ;Current frame.
dc.w 16 ;Width (16/32/64)
dc.w 21 ;Height
dc.w 16 ;Amt of colours.
dc.w 16 ;Colour start in palette.
dc.w 4 ;Amt of planes.
dc.w SPR_AGA|LORES|XLONG ;Attributes.
dc.l 0,0,0,0 ;Private.
ScreenStruct:
dc.l "GSV1"
dc.l 0,0,0 ;Screen_Mem1/2/3
dc.l 0 ;Screen link.
dc.l ScreenPalette ;Address of palette
dc.l 0 ;Address of rasterlist.
dc.l 32 ;Amt of colours in palette.
dc.w 256,320,320/8 ;Screen Height/Width/ByteWidth
dc.w 256,640,640/8 ;Picture Height/Width/ByteWidth
dc.w AMT_PLANES ;Amt_Planes
dc.w 0,0 ;Top Of Screen, X/Y
dc.w 16/8 ;Scroll buffer in pixels/8.
dc.w 0 ;X offset (for hor. scrolling).
dc.w 0 ;Y offset (for ver. scrolling).
dc.l NOBURST|HSCROLL ;Special attributes.
dc.w LORES ;Screen mode.
dc.b INTERLEAVED ;Screen type
dc.b 0 ;Screen Is Being Displayed?
dc.l 0,0 ;Reserved area.
even
ScreenPalette:
dc.w $0000,$0400,$0501,$0501,$0601,$0701,$0701,$0801
dc.w $0901,$0901,$0A02,$0432,$0CC0,$0F00,$0211,$0880
dc.w $01C2,$0050,$0B0B,$0606,$0F20,$0910,$0BBB,$0FFF
dc.w $00BF,$0068,$0568,$09BF,$0FF0,$0EE0,$0BA0,$0540
PackedPicFile:
IFNE LOCAL
dc.b "GAMESLIB:Demos/"
ENDC
dc.b "data/Pic640x256.pak",0
even
;===========================================================================;
;===========================================================================;
SECTION "Graphics",DATA_C
Gfx_Sparkie:
INCBIN "GAMESLIB:Store/Sparkie.raw"